Skip to content

Add OpenVoice UI: a macOS hands-free dictation app - #5

Open
TinaZhang66 wants to merge 2 commits into
ThinkFlowLab:mainfrom
TinaZhang66:swift-ui
Open

TinaZhang66 wants to merge 2 commits into
ThinkFlowLab:mainfrom
TinaZhang66:swift-ui

Conversation

@TinaZhang66

Copy link
Copy Markdown

Add OpenVoice: a macOS hands-free dictation app

  1. Tap a hotkey to start listening hands-free, keep talking across as
    many sentences as you like, tap the same hotkey again (or Esc) to
    stop. Three modes: Transcribe pastes the raw transcript, Translate
    pastes a translation, Agent answers what you said and shows it in its
    own persistent chat window instead of pasting.

  2. Talks to the local host from the previous commit over /v1/listen:
    streams raw PCM16 continuously, the host's own Silero VAD finds
    sentence boundaries, live partial text and a final result come back
    per utterance.

  3. Also: a personal vocabulary list for tricky terms, persisted history,
    a Models tab (live backend status, accurate/fast speed toggle), a
    configurable pause-cutoff, bilingual (EN/ZH) UI, and a first-run
    permissions walkthrough.

aliparchekan and others added 2 commits December 4, 2026 16:29
…-free listening, tools and speaker labels

Everything runs on one Mac with local models; nothing leaves the device.

Host (FastAPI, `python -m host.sessions`), API contract 0.6 in docs/reference.md:
- POST /v1/dictate (also ?stream=1), /v1/translate, /v1/respond, /v1/confirm;
  WebSocket /v1/dictate/stream and /v1/listen; /v1/capabilities, /v1/health;
  a demo page at /demo.
- Router: each stage (speech, fast speech, clean-up, translation) goes to a
  local OpenAI-compatible model server chosen by environment variables.
  Qwen3-ASR-1.7B (accurate) and a 4-bit build (fast), Qwen3-4B-Instruct-2507.
- Clean-up keeps the spoken language and skips the LLM for clean sentences;
  respond mode answers live, with follow-ups from the conversation.
- Translation drops spoken fillers (um, uh, ah, er, hmm, 呃, 嗯) before
  translating, by a fixed rule with no added time; "clean_up": false keeps
  them. raw always keeps every word.

Hands-free listening (/v1/listen):
- Silero VAD (MIT, bundled ONNX, CPU) finds each sentence; live partial text
  from the fast speech model while speaking; per-session conversation memory.
- vad.model chooses "silero" or "level" (the old loudness detector, for
  comparison); end_silence_ms sets the pause that ends a sentence.

Tools:
- The host is an MCP client (OPENVOICE_MCP, mcpServers format). Read-only tools
  run directly; any other tool asks first with a confirm event, answered by
  POST /v1/confirm or a spoken yes/no; no answer in 60 s is no.
- Example local server host/mcp_servers/mac.py: time, Shortcuts, links,
  reminders (relative and clock times).

Speaker labels (opt-in, speakers: true on /v1/listen):
- Nemotron-3-Diarization (OpenMDW-1.1, Q8 GGUF via NeMo-Speech.cpp), when
  OPENVOICE_DIAR_LIB and OPENVOICE_DIAR_MODEL are set: the whole session
  streams into one diarizer and each sentence takes the speaker who talked
  most; "also" lists anyone who talked over them. Keeps people apart over a
  whole meeting (AMI EN2002a, 36 min: 18.3% DER vs 45.8% per-sentence CAM++).
  No added wait (median speech end to transcript 480 ms vs 525 ms off),
  ~20% of one CPU core.
- CAM++ zh/en (Apache-2.0, 28 MB ONNX via sherpa-onnx), the fallback: labels
  each sentence S1, S2, ... in ~19 ms; enrolled voices get a name.
- POST/GET/DELETE /v1/speakers: consented enrolment from ~15 s of speech,
  stored only as a voiceprint on the device.
- In respond mode the model is told who spoke ([Speaker S1] ...) and whom it
  answered ([To S1] ...), so it keeps people's requests and likes apart.
- Measured and compared candidate models in docs/results/T20.md.

Quality and tests:
- host/eval: clean-up 16/16, respond 24/24, tool choice 10/10 on the 4-bit
  Qwen3-4B. 100 tests with faked backends (CI needs no models).
- CI keeps opentelemetry-api below 1.46: 1.46.0 breaks FastAPI 0.165.1's
  request telemetry (every request fails with a TypeError).

Squashes the former PRs ThinkFlowLab#2 and ThinkFlowLab#3 and fork PRs ThinkFlowLab#13
and ThinkFlowLab#14 (backups: backup/* branches on aliparchekan/OpenVoice).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tap a hotkey to start listening hands-free, keep talking across as
many sentences as you like, tap the same hotkey again (or Esc) to
stop. Three modes: Transcribe pastes the raw transcript, Translate
pastes a translation, Agent answers what you said and shows it in its
own persistent chat window instead of pasting.

Talks to the local host from the previous commit over /v1/listen:
streams raw PCM16 continuously, the host's own Silero VAD finds
sentence boundaries, live partial text and a final result come back
per utterance.

Also: a personal vocabulary list for tricky terms, persisted history,
a Models tab (live backend status, accurate/fast speed toggle), a
configurable pause-cutoff, bilingual (EN/ZH) UI, and a first-run
permissions walkthrough.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants